export default {
  inserted(el) {
    setTimeout(() => {
      const tags = el.querySelectorAll('.el-tag--info')
      for (let i = 0, len = tags.length; i < len; i++) {
        const tag = tags[i]
        const content = tag.querySelector?.('.el-select__tags-text')?.textContent || ''
        const closeIcon = tag.querySelector('.el-tag__close')
        if (closeIcon) {
          closeIcon.dataset.title = content
        }
      }
    }, 200)
  },
  componentUpdated(el, bindings, vnode) {
    const tags = el.querySelectorAll('.el-tag--info')
    for (let i = 0, len = tags.length; i < len; i++) {
      const tag = tags[i]
      const content = tag.querySelector?.('.el-select__tags-text')?.textContent || ''
      const closeIcon = tag.querySelector('.el-tag__close')
      if (closeIcon) {
        closeIcon.dataset.title = content
      }
    }
  }
}
